package com.example.springcloud.controller;

import com.example.springcloud.entities.CommonResult;
import com.example.springcloud.entities.Payment;
import com.example.springcloud.infra.feign.DemoInstanceFeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
@RestController
public class TestFeign {
    @Resource
    DemoInstanceFeignClient demoInstanceFeignClient;


    @RequestMapping("/testFeign/{id}")
    public CommonResult testFeign(@PathVariable("id") Long id){
        return demoInstanceFeignClient.getPayment(id);
    }

    @GetMapping(value = "/payment/discovery")
    public Object testDiscovery(){
        return demoInstanceFeignClient.discovery();
    }
}
